package cn.icanci.loopstack.lbrt.core.listener;

import cn.icanci.loopstack.lbrt.core.model.LbrtConfigBean;
import cn.icanci.loopstack.lbrt.core.processor.MockBeanPostProcessor;
import cn.icanci.loopstack.lbrt.core.utils.PropertiesUtil;

import javax.annotation.Resource;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @author icanci
 * @since 1.0 Created in 2023/06/15 16:21
 */
@Service
@SuppressWarnings("all")
public class LbrtCallbackCommandLineRunner implements CommandLineRunner {

    @Resource
    private ApplicationContext    context;
    @Resource
    private MockBeanPostProcessor mockBeanPostProcessor;

    @Override
    public void run(String... args) throws Exception {
        LbrtConfigBean bean = PropertiesUtil.assemblyLbrtBean(context.getClassLoader());
        mockBeanPostProcessor.process(bean);
    }
}
